package com.infore.qualityControl.quartz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.infore.qualityControl.service.ICQCreateQualityDataService;
import com.infore.qualityControl.service.ICreateQualityDataService;

@Component
@Scope("prototype")
public class ScheduledTasks {
	
	@Autowired
	ICreateQualityDataService iCreateQualityDataService;
	
	@Autowired
	ICQCreateQualityDataService iCQCreateQualityDataService;
	
//	public static CookieStore cookieStore = new BasicCookieStore();
//	public static CloseableHttpClient httpCilent = HttpClients.custom().setDefaultCookieStore(cookieStore).build();
	Object[] objects = new Object[0];
	public static final String indexCode = "w01019,w21003,w21011,w21001,w01018";

	/** 创建生成零点核查数据定时任务 **/
	public void GetZeroCheckDataJSon() {
		try {
			iCreateQualityDataService.createZeroCheckData(indexCode);
			System.out.println("零点核查数据创建完成！");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/** 创建生成跨度核查数据定时任务 **/
	public void GetSpanCheckDataJSon() {
		try {
			iCreateQualityDataService.createSpanCheckData(indexCode);
			System.out.println("跨度核查数据创建完成！");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/** 创建生成核查数据定时任务 **/
	public void GetCheckDataJSon() {
		try {
			iCreateQualityDataService.createCheckData();
			System.out.println("核查数据创建完成！");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/** 创建生成加标回收率数据定时任务 **/
	public void GetRecoveryDataJSon() {
		try {
			iCreateQualityDataService.createRecoveryData();
			System.out.println("加标回收率数据创建完成！");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/** 创建生成五参数数据定时任务 **/
	public void GetFiveParameterDataJSon() {
		try {
			iCQCreateQualityDataService.createFiveParameterData();
			System.out.println("五参数数据创建完成！");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/** 预警 **/
	public void SmsWaringDataJSon() {
		try {
			System.out.println("开始发送报警信息！");
			iCQCreateQualityDataService.sendWarnMessage();
			System.out.println("发送报警信息成功！");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
